{% extends '_partials/index.twig' %}

{% block head %}
    {{ parent() }}

    {{ css.inline('resources/css/blog.scss')|raw }}
    {{ css.inline('resources/css/overview.scss')|raw }}
{% endblock %}

{% block content %}
    {% if (overviewTitle ?? null) == 'programming' %}
        {% include '_partials/ad_scout.twig' %}
    {% endif %}

    <article class="blog">
        {% include '_partials/header_links.twig' %}

        <h1>
            <span>
                stitcher.io {{ overviewTitle ? overviewTitle : '' }}
            </span>
        </h1>
    </article>

    <div class="wrapper">
        <nav>
            {% for post in posts %}
                {% if post.hidden is not defined or post.hidden == false %}
                    <a href="{{ detailUrl ?? '/blog' }}/{{ post.id }}" {% if post.highlight is defined and post.highlight %}class="highlight"{% endif %}>
                        {% if post.date is defined %}
                            <span>
                                {{ post.date|date("Y-m-d") }}
                            </span>
                        {% endif %}

                        {% if post.title is defined %}
                            <span class="post-title">
                                {{ post.title }}
                            </span>
                        {% endif %}
                    </a>
                {% endif %}
            {% endfor %}
        </nav>
    </div>

    <footer>
        <nav>
            {% if _pagination.previous.url %}
                <a href="{{ _pagination.previous.url }}" class="prev cta cta-light">
                    Previous
                </a>
            {% endif %}

            {% if _pagination.next.url %}
                <a href="{{ _pagination.next.url }}" class="next cta cta-light">
                    Next
                </a>
            {% endif %}
        </nav>

        {% include '_partials/links.twig' %}
    </footer>
{% endblock %}
